package com.situ.day5.cal;

import com.situ.day5.Person;
import com.situ.day5.Student;

public class Demo {
    public static void main(String[] args) {
        Add add = new Add(3, 5);
        int result1 = add.getResult();
        System.out.println(result1);
        jiSuan(add);
        Sub sub = new Sub(3, 5);
        jiSuan(sub);

        //'Cal' is abstract; cannot be instantiated
        //Cal cal1 = new Cal(3, 5);
        //int res = cal1.getResult();
        //System.out.println(res);

        Person person = new Student();
        Cal cal = new Add(3, 5);
        int result2 = cal.getResult();
        System.out.println(result2);
        cal = new Sub(3, 5);
        int result3 = cal.getResult();
        System.out.println(result3);
    }

    public static void jiSuan(Cal cal) {
        cal.getResult();
    }

   /* public static void jiSuan(Add add) {
        add.getResult();
    }

    public static void jiSuan(Sub sub) {
        sub.getResult();
    }

    public static void jiSuan(Mul mul) {
        mul.getResult();
    }*/
}
